home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(enterFrame){
- if(die == 1)
- {
- if(this._x > 2100)
- {
- removeMovieClip(this);
- }
- if(this._x < -1400)
- {
- removeMovieClip(this);
- }
- this._xscale = mesize;
- this._yscale = mesize;
- myRadians = Math.atan2(this._y - _root.player._y,this._x - _root.player._x);
- xleg = this._x - _root.player._x;
- yleg = this._y - _root.player._y;
- scared = Math.sqrt(xleg * xleg + yleg * yleg);
- toploc = (_root.depth._y - this._y) * -1;
- if(this._y < _root.depth._y)
- {
- air += 0.4;
- if(this._rotation > 0)
- {
- if(this._rotation < 90)
- {
- this._rotation -= 3;
- }
- }
- if(this._rotation < 180)
- {
- if(this._rotation > 90)
- {
- this._rotation += 3;
- }
- }
- }
- else if(air > 0.5)
- {
- air -= 0.5;
- }
- if(movey == 1)
- {
- this._x += _global.xgo;
- this._y += _global.ygo + air;
- }
- this._x += Math.cos(3.141592653589793 * this._rotation / 180) * mespeed;
- this._y += Math.sin(3.141592653589793 * this._rotation / 180) * mespeed;
- if(scared < 300 - mespeed * 10)
- {
- if(toploc < 20)
- {
- if(_root.player._x < this._x)
- {
- this._rotation += 10;
- }
- else
- {
- this._rotation -= 10;
- }
- }
- else
- {
- myDegrees = Math.round(myRadians * 180 / 3.141592653589793);
- if(this._rotation > myDegrees)
- {
- this._rotation -= turnspeed;
- }
- if(this._rotation < myDegrees)
- {
- this._rotation += turnspeed;
- }
- }
- }
- }
- else if(movey == 1)
- {
- this._x += _global.xgo;
- this._y += _global.ygo;
- }
- if(this.eat.hitTest(_root.player.eat))
- {
- die = 0;
- eat = new Sound();
- eat.attachSound("eatit1");
- eat.start(0,1);
- this.gotoAndPlay("die");
- scoreity = Math.round(scoreworth);
- _root.instascore.text = "+" + scoreity;
- _root.instascore._y = 430;
- _global.scoreit = _global.scoreit * 1 + scoreity;
- }
- }
-